package editor;

import java.awt.Color;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JButton;

@SuppressWarnings("serial")
public class ToolButton extends JButton implements MouseListener
{ 

	//instance variables

	private CaptionTextArea text;

	//class constructor

	public ToolButton(String n, CaptionTextArea t) 
	{
		text = t;
		this.setText(n);
		addMouseListener(this);
	}

	//override the methods of implemented MouseListener

	public void mouseClicked(MouseEvent e) 
	{}

	public void mousePressed(MouseEvent e) 
	{}

	public void mouseReleased(MouseEvent e) 
	{}

	public void mouseEntered(MouseEvent e) 
	{ 

		if(e.getSource()==this) 
		{
			text.setCaptionText(this.getText());
		}

	}

	public void mouseExited(MouseEvent e) 
	{ 

		if(e.getSource()==this) 
		{ 
			text.setVoid();
		}
	
	}
}
